<!-- 订单页面 -->
<template>
  <Title content="我的订单"></Title>
  <div class="layout">
    <div class="order">
      <OrderCard v-for="item in orderList" :key="item.shopId" :order="item"></OrderCard>
    </div>
  </div>
  <Docker page="order"></Docker>
</template>

<script>
import { ref } from 'vue'
import Docker from '@/components/docker.vue'
import Title from '@/components/title'
import OrderCard from './components/orderCard'
import { get } from '@/utils/request'
import { ORDER_LIST } from '@/api/interface'
// 请求订单数据
const useOrderRequest = () => {
  const orderList = ref('');
  const getData = async () => {
    try {
      orderList.value = (await get(ORDER_LIST)).data;
    } catch (error) {
      console.log(error);
    }
  }
  getData()
  return { orderList }
}
//composition
export default {
  name: 'order',
  components: { Docker, Title, OrderCard },
  setup() {
    const { orderList } = useOrderRequest();
    return { orderList }
  }
}
</script>

<style scoped lang="scss">
@import '@/styles/theme.scss';
@import '@/styles/mixin.scss';

.layout {
  @include layout-remove-docker;
  padding-top: 11.7333vw;

  .order {
    @include page-layout;
    background-color: $background-color;
    padding: 16px 18px 0;
  }
}
</style>